package com.zz.admin.authMenuManagement.controller;

import com.zz.admin.authMenuManagement.dto.AuthMenuDto;
import com.zz.admin.authMenuManagement.service.AuthMenuService;
import java.util.List;
import java.util.Map;

import com.zz.common.base.dto.PageListResultDto;
import com.zz.common.base.dto.ResponseDTO;
import com.zz.common.base.dto.ResultDto;
import com.zz.common.constants.ApiConstants;

import io.swagger.annotations.Api;
import jakarta.annotation.Resource;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * 菜单 服务接口类
 * @author zl
 * @since 2025-11-16 20:04:12
 */
@Api(tags = "菜单服务接口类")
@RestController
@RequestMapping("auth-menu-management/v1.0/auth-menu")
public class AuthMenuController {

    @Resource
    private AuthMenuService authMenuService;

    @RequestMapping(value = "/query-with-page", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-分页查询", notes = "传入分页信息")
    public PageListResultDto<AuthMenuDto> queryWithPage(@RequestBody AuthMenuDto authMenuDto) {
        PageListResultDto<AuthMenuDto> res;
        res = authMenuService.queryWithPage(authMenuDto, authMenuDto.getQueryParam());
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

    
    @RequestMapping(value = "/query-with-no-page", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-不分页查询", notes = "传入查询条件信息")
    public ResponseDTO<List<AuthMenuDto>> queryWithNoPage(@RequestBody AuthMenuDto authMenuDto) {
        ResponseDTO<List<AuthMenuDto>> res = new ResponseDTO<>();
        res.setData(authMenuService.queryWithNoPage(authMenuDto));
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }
    
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ApiOperation(value = "菜单-查询ById", notes = "传入id")
    public ResponseDTO<AuthMenuDto> queryById(@PathVariable("id") String id) {
        ResponseDTO<AuthMenuDto> res = new ResponseDTO<>();
        AuthMenuDto result = authMenuService.queryById(id);
        res.setData(result);
        return res;
    }

    @RequestMapping(value = "/query-by-ids", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-查询ByIds", notes = "传入ids")
    public ResponseDTO<List<AuthMenuDto>> queryByIds(@RequestBody List<String> ids) {
        ResponseDTO<List<AuthMenuDto>> res = new ResponseDTO<>();
        res.setData(authMenuService.queryByIds(ids));
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

    @RequestMapping(value = "/save", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-创建", notes = "创建")
    public ResultDto save(@RequestBody AuthMenuDto authMenuDto) {
        ResultDto res = new ResultDto();
        authMenuService.save(authMenuDto);
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

    @RequestMapping(value = "/save-batch", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-创建", notes = "创建")
    public ResultDto saveBatch(@RequestBody List<AuthMenuDto> authMenuDtos) {
        ResultDto res = new ResultDto();
        authMenuService.saveBatch(authMenuDtos);
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-修改", notes = "修改")
    public ResultDto modify(@RequestBody AuthMenuDto authMenuDto) {
        ResultDto res = new ResultDto();
        authMenuService.modify(authMenuDto);
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

    @RequestMapping(value = "/modify-batch", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-修改", notes = "修改")
    public ResultDto modifyBatch(@RequestBody List<AuthMenuDto> authMenuDtos) {
        ResultDto res = new ResultDto();
        authMenuService.modifyBatch(authMenuDtos);
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

    @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
    @ApiOperation(value = "菜单-删除ById", notes = "传入id")
    public ResultDto delete(@PathVariable("id")  String id) {
        ResultDto res = new ResultDto();
        authMenuService.delete(id);
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

    @RequestMapping(value = "/delete-batch", method = RequestMethod.POST)
    @ApiOperation(value = "菜单-批量删除", notes = "传入id")
    public ResultDto deleteBatch(@RequestBody List<String> ids) {
        ResultDto res = new ResultDto();
        authMenuService.deleteBatch(ids);
        res.setCode(ApiConstants.RESULT_SUCCESS);
        res.setMessage(ApiConstants.MESSAGE_SUCCESS);
        return res;
    }

}